package com.huawei.hwCloudJs.d;

import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.huawei.hwCloudJs.b.a;

public class d {
    public static final String a = "none";
    public static final String b = "unknown";
    public static final String c = "2g";
    public static final String d = "3g";
    public static final String e = "4g";
    public static final String f = "wifi";
    public static final int g = 16;
    public static final int h = 17;
    public static final int i = 18;
    private static final String j = "NetUtils";

    public static boolean a() {
        return !b().equalsIgnoreCase(a);
    }

    public static String b() {
        ConnectivityManager connectivityManager = (ConnectivityManager) a.a().getSystemService("connectivity");
        NetworkInfo activeNetworkInfo = connectivityManager != null ? connectivityManager.getActiveNetworkInfo() : null;
        if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable()) {
            return a;
        }
        if (!"mobile".equalsIgnoreCase(activeNetworkInfo.getTypeName())) {
            return f;
        }
        switch (activeNetworkInfo.getSubtype()) {
            case 1:
            case 2:
            case 4:
            case 7:
            case 11:
            case 16:
                return c;
            case 3:
            case 5:
            case 6:
            case 8:
            case 9:
            case 10:
            case 12:
            case 14:
            case 15:
            case 17:
            case 18:
                return d;
            case 13:
                return e;
            default:
                return b;
        }
    }
}
